package mainPackage;

import interfacePackage.TobtobFenetre;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;

import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import pathFinderPackage.Itineraire;
import pathFinderPackage.BiDijkstra.BiDirectionnalDijkstra;

import mapPackage.IRoute;
import mapPackage.IVille;
import mapPackage.MapException;
import xmlPackage.Carte;
import xmlPackage.GraphNotLoadedException;

public class Main {

	/**
	 * @param args
	 * @throws GraphNotLoadedException 
	 */
	public static void main(String[] args) throws MapException, GraphNotLoadedException 
	{
		
			String villeD = "ville1";
			String villeA = "ville999";

			System.out.println("lecture de la carte");
					try {
						Carte.GetInstance().lireXML("xmlFile.xml");
					} catch (GraphNotLoadedException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
						
					}
					System.out.println("[OK]");
					
					Operateur op = new Operateur();
					
					op.setPathFinder( new BiDirectionnalDijkstra() );
			
					
			op.trouverItineraire(villeD, villeA );
			
			Itineraire it = new Itineraire();
			for (int i = 0; i < op.getNbEtapes() ; i++) 
			{
				it.ajouterTroncon(op.getTronconEtape(i), i);
			}
			it.setVilleDepart(op.getVilleDepart());
			it.setVilleArrivee(op.getVilleArrivee());

			
			System.out.println("itineraire solution : "+it);
			
	//
//					
		
		
		
	}


}
